/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.swt.mto.thithu.model.impl;

import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;

import com.swt.mto.thithu.model.Quiz;

import java.io.Serializable;

import java.util.Date;

/**
 * The cache model class for representing Quiz in entity cache.
 *
 * @author tuan.nguyen
 * @see Quiz
 * @generated
 */
public class QuizCacheModel implements CacheModel<Quiz>, Serializable {
	@Override
	public String toString() {
		StringBundler sb = new StringBundler(19);

		sb.append("{quizId=");
		sb.append(quizId);
		sb.append(", createUserId=");
		sb.append(createUserId);
		sb.append(", modifyUserId=");
		sb.append(modifyUserId);
		sb.append(", quizCategoryId=");
		sb.append(quizCategoryId);
		sb.append(", title=");
		sb.append(title);
		sb.append(", description=");
		sb.append(description);
		sb.append(", createDate=");
		sb.append(createDate);
		sb.append(", modifydate=");
		sb.append(modifydate);
		sb.append(", time=");
		sb.append(time);
		sb.append("}");

		return sb.toString();
	}

	public Quiz toEntityModel() {
		QuizImpl quizImpl = new QuizImpl();

		quizImpl.setQuizId(quizId);
		quizImpl.setCreateUserId(createUserId);
		quizImpl.setModifyUserId(modifyUserId);
		quizImpl.setQuizCategoryId(quizCategoryId);

		if (title == null) {
			quizImpl.setTitle(StringPool.BLANK);
		}
		else {
			quizImpl.setTitle(title);
		}

		if (description == null) {
			quizImpl.setDescription(StringPool.BLANK);
		}
		else {
			quizImpl.setDescription(description);
		}

		if (createDate == Long.MIN_VALUE) {
			quizImpl.setCreateDate(null);
		}
		else {
			quizImpl.setCreateDate(new Date(createDate));
		}

		if (modifydate == Long.MIN_VALUE) {
			quizImpl.setModifydate(null);
		}
		else {
			quizImpl.setModifydate(new Date(modifydate));
		}

		quizImpl.setTime(time);

		quizImpl.resetOriginalValues();

		return quizImpl;
	}

	public long quizId;
	public long createUserId;
	public long modifyUserId;
	public long quizCategoryId;
	public String title;
	public String description;
	public long createDate;
	public long modifydate;
	public int time;
}